<template>
  <a-input
    type="textarea"
    :rows="rows"
    :style="{width:width>0?`${width}px`:'100%'}"
    v-model.trim="val"
    :placeholder="placeholder"
    :disabled="disabled">
  </a-input>
</template>

<script>
export default {
  model: {
    prop: 'modelVal',
    event: 'change'
  },
  props: {
    modelVal: {
      type: String,
      default: ''
    },
    width: {
      type: Number,
      default: 0
    },
    placeholder: {
      type: String,
      default: '请输入内容'
    },
    disabled: {
      type: Boolean,
      default: false
    },
    rows: {
      type: Number,
      default: 4
    }
  },
  data () {
    return {
      val: ''
    }
  },
  mounted () {
    this.val = this.modelVal
  },
  watch: {
    modelVal (v) {
      this.val = v
    },
    val (v) {
      this.$emit('change', v)
    }
  },
  methods: {
  }
}
</script>
<style lang="scss" scoped>
</style>
